home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 2 / Amiga Tools 2.iso / dfue / avmnfax / rexx / printfile.avm < prev    next >
Text File  |  1995-03-09  |  1KB  |  43 lines

  1. /* print out a fax file */
  2. parse arg filename .
  3.  
  4. faxprogram = upper(getclip('AVMFaxProgram'))
  5. if faxprogram = 'TRAPFAX' then do
  6.  
  7.   address command 'trapfax:tfaxview PRINT ' || filename
  8. end
  9. else
  10. do   /* if else */
  11.  
  12.  base = filename || '.'
  13.  
  14.  do i = 1 to 999
  15.    if ~exists(base || right(i, 3, '0')) then break
  16.  end
  17.  
  18.  lastPage = i - 1
  19.  
  20.  /* extract filename base */
  21.  lcolon = lastpos(':', filename)
  22.  lslash = lastpos('/', filename)
  23.  if lcolon > lslash then last = lcolon
  24.  else last = lslash
  25.  last = last
  26.  
  27.  faxFileName = right(filename, length(filename) - last)
  28.  
  29.  do i = 1 to 999
  30.    if ~exists(base || right(i, 3, '0')) then break
  31.    address command 'avm:gnu/fax2iff' '-o faxtemp:' || faxFileName || '.' || right(i, 3, '0') base || right(i, 3, '0')
  32.    if rc = 0 then do
  33.      address command 'avm:avmfaxprint faxtemp:' || faxFileName || '.' || right(i, 3, '0') i lastPage
  34.      saveRC = rc
  35.     call delete('faxtemp:' || faxFileName || '.' || right(i, 3, '0'))
  36.     if saveRC ~= 0 then signal done
  37.    end
  38.  end
  39.  
  40. end /*if*/
  41. done:
  42.  
  43.